﻿using System;

namespace Little.Soldier.SWIFT.Definition
{
  [Serializable]
  internal class SwiftTagDefinition : SwiftDefinitionElement
  {
    private string _tagName;
    private bool _multiple;

    public bool Multiple
    {
      get
      {
        return this._multiple;
      }
      set
      {
        this._multiple = value;
      }
    }

    public string TagName
    {
      get
      {
        return this._tagName;
      }
      set
      {
        this._tagName = value;
      }
    }

    public SwiftTagDefinition()
    {
    }

    public SwiftTagDefinition(string name, string description)
      : base(name, description)
    {
    }

    public override void U008E(SwiftDefinitionElement element)
    {
      if (!(element is SwiftTagSubItemDefinition))
        throw new InvalidOperationException("SwiftTag can only contain SwiftTagSubItem elements");
      base.U008E(element);
    }

    public override bool U008F(object obj)
    {
      if (!(obj is SwiftTagDefinition))
        return false;
      else
        return base.U008F(obj);
    }

    public override string ToString()
    {
      return this._tagName;
    }
  }
}
